import {reqCreateOrder, reqGetRoomsList, reqGetRoomsSelectList, reqGetUserInfoOfToken, reqUpdateOrderInfo} from "@/api";

const state = {
    roomsListData:{},
};
const actions = {
    async getRoomsListData({commit}, config){
        let result = await reqGetRoomsList(config);
        if (result.code == 200){
            commit("GETROOMSLISTDATA", result.data);
        }
    },
    async getRoomsSelectListData({commit}, info){
        let result = await reqGetRoomsSelectList(info.classifyId);
        if (result.code == 200){
            commit("GETROOMSSELECTLISTDATA", result.data);
        }
    },
    async createOrder({commit}, info){
        let result = await reqCreateOrder(info);
        if (result.code == 200){
            confirm("提交成功");
        }
    }
};
const mutations = {
    GETROOMSLISTDATA(state, data){
        state.roomsListData = data;
    },
    GETROOMSSELECTLISTDATA(state, data){
        state.roomsListData = data;
    }
};
const getters = {
    getRoomsListData(){
        return state.roomsListData;
    }
};

export default {
    state,
    actions,
    mutations,
    getters
}